package com.wmeimob.fastboot.jiubei.result;

/**
 * @Description 将结果转为封装后的对象
 *
 * @auther  wang
 */
public class RestResponse {
    private final static String SUCCESS = "success";

    public static <T> RestResults<T> makeOKRsp() {
        return new RestResults<T>().setCode(RestCode.SUCCESS).setMsg(SUCCESS);
    }

    public static <T> RestResults<T> makeOKRsp(T data) {
        return new RestResults<T>().setCode(RestCode.SUCCESS).setMsg(SUCCESS).setData(data);
    }
    public static <T> RestResults<T> makeOKRspZero(T data) {
        return new RestResults<T>().setCode(RestCode.SUCCESS_ZERO).setMsg(SUCCESS).setData(data);
    }
    public static <T> RestResults<T> makeErrRsp(String message) {
        return new RestResults<T>().setCode(RestCode.FAIL).setMsg(message);
    }

    public static <T> RestResults<T> makeRsp(int code, String msg) {
        return new RestResults<T>().setCode(code).setMsg(msg);
    }

    public static <T> RestResults<T> makeRsp(int code, String msg, T data) {
        return new RestResults<T>().setCode(code).setMsg(msg).setData(data);
    }
}
